package;

import board.Roulette;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.text.FlxText;
import flixel.ui.FlxButton;
import flixel.util.FlxMath;
import flixel.addons.ui.FlxSlider;

/**
 * A FlxState which can be used for the game's menu.
 */
class RuletaTestState extends FlxState
{
	/**
	 * Function that is called up when to state is created to set it up. 
	 */
	
	var ruleta:Roulette;
	var spinButton:FlxButton;
	var accSlider:FlxSlider;
	var velocidadSlider:FlxSlider;
	var desAccSlider:FlxSlider;
	var tiempoSlider:FlxSlider;
	var result:FlxText;
	override public function create():Void
	{
		super.create();
		ruleta = new Roulette();
		add(ruleta);
		
		spinButton = new FlxButton(420, 20, "Spin!", ruleta.spin);
		add(spinButton);
		
		accSlider = new FlxSlider(ruleta, "acceleracion", 420, 60, 0, 500,200,15,3,0xFFFFFFFF);
		accSlider.decimals = 0;
		add(accSlider);
		
		velocidadSlider = new FlxSlider(ruleta, "velocidadMaxima", 420, 120, 0, 1000,200,15,3,0xFFFFFFFF);
		velocidadSlider.decimals = 0;
		add(velocidadSlider);
		
		desAccSlider = new FlxSlider(ruleta, "desacceleracion", 420, 180, 0, 500,200,15,3,0xFFFFFFFF);
		desAccSlider.decimals = 0;
		add(desAccSlider);
		
		tiempoSlider = new FlxSlider(ruleta, "tiempoMaximo", 420, 240, 0, 10, 200, 15, 3, 0xFFFFFFFF);
		tiempoSlider.decimals = 0;
		add(tiempoSlider);
		
		result = new FlxText(420, 320, 200, "Resultado:", 18);
		add(result);
	}
	
	/**
	 * Function that is called when this state is destroyed - you might want to 
	 * consider setting all objects this state uses to null to help garbage collection.
	 */
	override public function destroy():Void
	{
		super.destroy();
	}

	/**
	 * Function that is called once every frame.
	 */
	override public function update():Void
	{
		super.update();
		if (ruleta.getMode() != -1)
			result.text = "Resultado: " + Std.string(ruleta.getMode());
	}	
}